<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
	</head>
	<body>
		<input type="button" onclick="alert('hello js')" value="click"/><br/>
		<input type="text" onblur="myBlur()" onfocus="myFocus()"/><br/>
		<input type="button" onclick="myClick()" onmouseenter="myEnter()" onmouseleave="myLeave()" value="click" />
		<br />
		<input type="button" value="click" />
		
		<script type="text/javascript">
			
			window.onload = function() {
				//页面加载完之后，得到这个button对象，动态的给他添加事件
				var btn = document.getElementsByTagName("input")[3];
				btn.onclick = function() {
					console.log("onclick");
				}
				btn.onmouseenter = function() {
					console.log("onmouseenter");
				}
				btn.onmouseleave = function() {
					console.log("onmouseleave");
				}
			}
			
			function myClick() {
				console.log("click")
			}
			
			function myEnter() {
				console.log("enter")
			}
			
			function myLeave() {
				console.log("leave")
			}
			
			function myBlur() {
				console.log("blur")
			}
			
			function myFocus() {
				console.log("focus")
			}
		</script>
	</body>
</html>